var Logger = Function();

Logger.getLogger = function (_level, _dom){
	var logger = new Logger();
	if(!logger.prototype){
		logger.prototype = {};
	}
	if(typeof _level=='number'){
		logger.level = _level;
		logger.prototype.level = _level;
	}
	if(_dom){
		logger.dom = _dom;
		logger.prototype.dom = _dom;
	}
	return logger;
};

Logger.INFO  = 0;
Logger.DEBUG = 500;
Logger.WARN  = 1000;
Logger.ERROR = 1500;
Logger.NEVER = + Infinity;

Logger.prototype.log = function(_l, msg){
	if(_l>=this.level){
		this.dom.appendChild(document.createTextNode(msg));
		this.dom.innerHTML+="<br>";
	}
}
Logger.prototype.info = function(msg){
	this.log(Logger.INFO, msg);
}
Logger.prototype.debug = function(msg){
	this.log(Logger.DEBUG, msg);
}
Logger.prototype.warn = function(msg){
	this.log(Logger.WARN, msg);
}
Logger.prototype.error = function(msg){
	this.log(Logger.ERROR, msg);
}

